# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Vision.V1.Model.ProductSearchParams do
  @moduledoc """
  Parameters for a product search request.

  ## Attributes

  *   `boundingPoly` (*type:* `GoogleApi.Vision.V1.Model.BoundingPoly.t`, *default:* `nil`) - The bounding polygon around the area of interest in the image. If it is not specified, system discretion will be applied.
  *   `filter` (*type:* `String.t`, *default:* `nil`) - The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='.
  *   `productCategories` (*type:* `list(String.t)`, *default:* `nil`) - The list of product categories to search in. Currently, we only consider the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1", or "general-v1" should be specified. The legacy categories "homegoods", "apparel", and "toys" are still supported but will be deprecated. For new products, please use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search accuracy. It is recommended to migrate existing products to these categories as well.
  *   `productSet` (*type:* `String.t`, *default:* `nil`) - The resource name of a ProductSet to be searched for similar images. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :boundingPoly => GoogleApi.Vision.V1.Model.BoundingPoly.t() | nil,
          :filter => String.t() | nil,
          :productCategories => list(String.t()) | nil,
          :productSet => String.t() | nil
        }

  field(:boundingPoly, as: GoogleApi.Vision.V1.Model.BoundingPoly)
  field(:filter)
  field(:productCategories, type: :list)
  field(:productSet)
end

defimpl Poison.Decoder, for: GoogleApi.Vision.V1.Model.ProductSearchParams do
  def decode(value, options) do
    GoogleApi.Vision.V1.Model.ProductSearchParams.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Vision.V1.Model.ProductSearchParams do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
